package com.magicsoft.share.presenter.article;

import com.magicsoft.share.base.BasePresenter;
import com.magicsoft.share.bean.share.ArticleType;
import com.magicsoft.share.constant.APIService;
import com.magicsoft.share.rx_retrofit_network.location.retrofit.RetrofitUtil;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.NetWorkTransformer;
import com.magicsoft.share.rx_retrofit_network.location.rxandroid.SimpleObserver;
import com.magicsoft.share.view.article.ISortView;

import java.util.List;

import io.reactivex.annotations.NonNull;

/**
 * Created by lyf on 2017/12/7/007.
 */

public class SortPresenter extends BasePresenter<ISortView> {
    public void articleTypeList(){
        RetrofitUtil.getApi(APIService.class)
                .articleTypeList()
                .compose(new NetWorkTransformer<List<ArticleType>>())
                //   .compose(new LoadingTransformer<List<ArticleType>>(mContext))
                .subscribe(new SimpleObserver<List<ArticleType>>(mCompositeDisposable) {
                    @Override
                    public void call(@NonNull List<ArticleType> articleTypes) {

                        getView().articleTypeListSuccess(articleTypes);
                    }
                });
    }
}
